import { Injectable } from '@angular/core';
import { HOSTURL, PREFIX } from '../../../config';
import { RequestClientService } from '../../request-client.service';

@Injectable({
  providedIn: 'root'
})
export class DrawingsService {

  constructor(
    private requestClientService: RequestClientService
  ) {
  }

  // 获取图纸列表
  // public async getDrawingsLists(params) {
  //   const res = await this.requestClientService.post(HOSTURL + `/api/services/${PREFIX}/Drawings/QueryDrawingPagedList`, params);
  //   return res;
  // }
  public async getDrawingsLists(params) {
    const res = await this.requestClientService.post(HOSTURL + `/api/services/${PREFIX}/Drawings/QueryModelsPagedList`, params);
    return res;
  }
  // 获取模型列表
  public async getModelLists(params) {
    const res = await this.requestClientService.post(HOSTURL + `/api/services/${PREFIX}/Projects/QueryModelsPagedList`, params);
    return res;
  }
  public async QueryModelGroupsPagedList(params) {
    const res = await this.requestClientService.post(HOSTURL + `/api/services/${PREFIX}/Projects/QueryModelGroupsPagedList`, params);
    return res;
  }
  // 添加图纸列表
  // public async addDrawings(params) {
  //   const res = await this.requestClientService.post(HOSTURL + `/api/services/${PREFIX}/Drawings/CreateDrawing`, params);
  //   return res;
  // }
  // 111
  public async addDrawings(params) {
    const res = await this.requestClientService.post(HOSTURL + `/api/services/${PREFIX}/Drawings/CreatOrModifyModel`, params);
    return res;
  }
  // 向业务端发起模型解析请求
  public async ConvertModel(params) {
    const res = await this.requestClientService.post(HOSTURL + `/api/services/${PREFIX}/Drawings/ConvertModel`, params);
    return res;
  }
  // 修改图纸列表 (6.20 后暂未使用该接口)
  public async editDrawings(params) {
    const res = await this.requestClientService.post(HOSTURL + `/api/services/${PREFIX}/Drawings/ModifyDrawing`, params);
    return res;
  }
  // 删除图纸列表
  // public async deleteDrawings(params) {
  //   const res = await this.requestClientService.post(HOSTURL + `/api/services/${PREFIX}/Drawings/BatchRemoveDrawings`, params);
  //   return res;
  // }
   // 111 
   public async deleteDrawings(params) {
    const res = await this.requestClientService.delete(HOSTURL + `/api/services/${PREFIX}/Drawings/RemoveModel`, params);
    return res;
  }
  //  // 图形后台删除图纸
  //  public async delDrawingsFromGraphicsServer(json) {
  //   let res = await this.requestClientService.postSSO(`${FILEURL}/api/v${version}/FileConvert/delete-model`, json);
  //   return res;
  // }

}
